package com.enjoy.aop.dynamicProxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class CHandler implements InvocationHandler {

    private IC ic;

    public CHandler(IC ic) {
        this.ic = ic;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if ("xx".equals(method.getName()) || "xx1".equals(method.getName())) {
            System.out.println("------增强了:" + method.getName());
            return method.invoke(this.ic, args);
        }
        return proxy;
    }
}
